package com.group.doctor.controller;


import com.group.commons.util.ResponseStatus;
import com.group.doctor.service.IDoctorService;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-06-07
 */
@RestController
@RequestMapping("/doctor")
public class DoctorController {
    @Resource
    IDoctorService doctorService;

    /**
     * 批量删除
     * @param ids 多个id
     * @return 删除成功的状态
     */
    @DeleteMapping("/delete")
    public ResponseStatus deleteByIds(@RequestBody int[] ids) {
        List<Integer> list = Arrays.stream(ids).boxed().collect(Collectors.toList());
        doctorService.removeByIds(list);
        return ResponseStatus.SUCCESS;
    }
}
